<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <style type="text/css">
        html,
        body {
            height: 100%;
            /* position: absolute;
            z-index: 100000; */
        }

        .wrap {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
            position: relative;
        }

        header {
            height: 44px;
            width: 100%;
            text-align: center;
            background-color: #81a9c3;
            color: #fff;
            line-height: 44px;
            font-size: 20px;
        }

        .flex-1 {
            display:flex;
            flex-direction: row;
            flex-wrap: wrap;
            flex:1;
        }

        footer {
            height: 30px;
            width: 100%;
            background-color: #81a9c3;
            color: white;
            line-height: 30px;
            text-align: center;
        }

        .function{
            font-size: 16px;
            padding: 5px 10px;
            border: 1px solid blue;
            border-radius: 3px;
            margin: 5px;
            text-align: center;
            z-index : 9999;
        }

        .live-info{
            display: inline-block;
        }

        .live-info .label{
            display: inline-block;
        }

        .live-info input{
            width: 60px;
        }

        .bottom {
            position: absolute;
            bottom: 0;
            z-index: 0;
            /* display: none; */
        }

        .padding-5{
            padding: 0px 5px;
        }

    </style>
</head>

<body class="wrap">
<div id="view" v-cloak></div>
    <!-- <iframe src="html/beauty.html" style="z-index:9999" width="100%" height="100%">

    </iframe> -->
</body>

<script type="text/javascript" src="../../script/api.js"></script>
<script src="../../script/ffkj.js"></script>
<script type="text/javascript" src="../../script/mhsdk.js"></script>

<script type="text/javascript" >

    apiready = function name(params) {
        _listener('keyback', function() {
            exitRoom()
        })
        //sdk初始化
        mhsdkApi.mhInit();
        showDetail('frame4/meiyan_menu')
        //设置用户远端视频可见回调
        mhsdkApi.setOnUserVideoAvaialeListener(function(ret) {
            console.log('vvvvvvvvvvvvvvvvvv=====================');
            console.log(JSON.stringify(ret));
            console.log('--onvideo->',ret);
            let data  = ret.detail
            if (data.code == '1'){ //连麦
                mhsdkApi.startLink({
                    linkUserId:data.msg,
                    linkStreamId:data.msg,
                    playUrl:"",
                    localVideoBig:0
                })
            }
        });
        getPermission(['microphone', 'camera', 'photos'], function(code) {
            if (code != 0) {
                _msg('请先开启相关权限');
            } else {
                //sdk初始化
                mhsdkApi.mhInit();
                //设置用户远端视频可见回调
                mhsdkApi.setOnUserVideoAvaialeListener(function(ret) {
                    console.log('vvvvvvvvvvvvvvvvvv=====================');
                    console.log(JSON.stringify(ret));
                    console.log('--onvideo->',ret);
                    let data  = ret.detail
                    if (data.code == '1'){ //连麦
                        mhsdkApi.startLink({
                            linkUserId:data.msg,
                            linkStreamId:data.msg,
                            playUrl:"",
                            localVideoBig: 0
                        })
                    }
                });

                mhsdkApi.startPreview()
            }
        })
    }
    function switchCamera(){
        mhsdkApi.switchCamera()
    }
    function openMeiyan(){
        mhsdkApi.openMeiYan();
    }
    function exitRoom(){
        mhsdkApi.stopPreview();
        api.closeWin();
    }

</script>



</html>
